package main

import (
	"fmt"
	"runtime"
	"time"
)

var ch chan int

func test(i int) {
	fmt.Println(i)
	fmt.Printf("goroutine num:%d\n", runtime.NumGoroutine())

	<-ch
}
func main() {
	ch = make(chan int, 10)
	for i := 0; i < 100000; i++ {
		go test(i)
	}
	time.Sleep(1000 * time.Second)
	fmt.Println("main exit!")
}
